package com.ln.adoms.service;

import com.ln.adoms.dao.DepartSettingDao;
import com.ln.adoms.entity.Brand;
import com.ln.adoms.entity.DepartSetting;
import com.ln.core.orm.hibernate.BaseDao;
import com.ln.core.orm.hibernate.BaseService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
@Transactional
public class DepartSettingService extends BaseService<DepartSetting> {

    private DepartSettingDao departSettingDao;

    @Override
    @Resource(name = "departSettingDao")
    public void setBaseDao(BaseDao<DepartSetting> baseDao) {
        this.baseDao = baseDao;
        this.departSettingDao = (DepartSettingDao) baseDao;
    }


    @Override
    public void save(DepartSetting entity) {
        if (entity.isNew()) {
            super.save(entity);
        } else {
            super.update(entity);
        }
    }

    /**
     * 获取部门自动收货时间配置
     *
     * @param departmentId
     * @return
     */
    public DepartSetting getAutoReceiveOrderSetting(Integer departmentId) {
        return departSettingDao.getAutoReceiveOrderSetting(departmentId);
    }
}
